import yaml


with open('config.yml', 'r') as f:
    doc = yaml.load(f, Loader=yaml.FullLoader) # 将yaml文件转换成python的字典格式
    print("doc:", doc, "type:", type(doc))
    for k, v in doc.items():
        print(k, "->", v)
    
    print("doc['gpu_id']:", doc['gpu_id'])

    print("doc['train']['batch_size']:", doc['train']['batch_size'])